//
//  VPPresentViewController.m
//  VPPublicUntilitisForPod
//
//  Created by vernepung on 2017/8/25.
//  Copyright © 2017年 vernepung. All rights reserved.
//

#import "VPPresentViewController.h"
#import "VPPresentedViewController.h"
#import "BaseNavigationController.h"
#import "VPBouncePresentAnimation.h"
#import "VPSwipeUpInteractiveTransition.h"

@interface VPPresentViewController ()<VPModalViewControllerDelegate>
//@property (strong, nonatomic) VPDismissAnimation *dismissAnimation;
@property (strong, nonatomic) VPBouncePresentAnimation *bounceAnimation;
@property (strong, nonatomic) VPSwipeUpInteractiveTransition *swipeUpInteractiveTransition;
@end

@implementation VPPresentViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.dismissAnimation = [[VPDismissAnimation alloc]init];
    self.bounceAnimation = [[VPBouncePresentAnimation alloc]init];
    self.swipeUpInteractiveTransition = [[VPSwipeUpInteractiveTransition alloc]init];
    // Do any additional setup after loading the view.
    self.title = @"present";
    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(80.0, 210.0, 50, 50);
    [button setTitle:@"present to viewcontroller" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
   
    [self.view addSubview:button];
}

- (void)buttonClicked:(UIButton *)sender {
    VPPresentedViewController *presentedViewController = [[VPPresentedViewController alloc] init];
    presentedViewController.delegate = self;
    BaseNavigationController *nav = [[BaseNavigationController alloc]initWithRootViewController:presentedViewController];
    nav.modalPresentationStyle = UIModalPresentationCustom;
    [self presentViewController:nav animated:YES completion:nil];
}

//- (id<UIViewControllerInteractiveTransitioning>)interactionControllerForDismissal:(id<UIViewControllerAnimatedTransitioning>)animator {
//    return self.swipeUpInteractiveTransition.interacting ? self.swipeUpInteractiveTransition : nil;
//}

- (void)modalViewControllerDidDismiss {
    [self dismissViewControllerAnimated:YES completion:nil];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
